package com.sky.mapper;

import com.sky.entity.Dish;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author majun
 * @package sky-take-out
 * @date 2024/5/12 : 下午9:03
 */

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查询套餐id
     *
     * @param dishIds
     * @return
     */
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 添加套餐绑定菜品
     *
     * @param setmealDishes
     */
    void save(List<SetmealDish> setmealDishes);

    /**
     * 根据套餐id查询绑定菜品信息
     *
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getFromById(String setmealId);

    /**
     * 根据id删除菜品
     *
     * @param id
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{id}")
    void detele(Long id);
}
